﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SnakeGame
{
    class Screen
    {
        private int width, height = 5;
        private char[,] elements;
        private const char defaultElement = '+';

        public Screen(int width, int height)
        {
            this.width = width;
            this.height = height;

            elements = new char[width,height];
            Clear();
        }

        public void Clear()
        {
            for(int ix = 0; ix< width; ix++)
            {
                for(int iy = 0; iy < height; iy++)
                {
                    elements[ix, iy] = defaultElement;
                }
            }
        }

        public void SetElement(int x, int y, char element)
        {
            if(x < 0 || x >= width || y < 0 || y >= height)
            {
                return;
            }
            elements[x, y] = element;
        }

        public void Display()
        {
            Console.Clear();
            for(int iy = 0; iy < height; iy++)
            {
                for(int ix = 0; ix < width; ix++)
                {
                    Console.Write(elements[ix, iy]);
                }
                Console.Write('\n');
            }
        }
    }
}
